from autoframe.common.base import *


class LoginPage(Base):
    def input_username(self, username):
        self.find_element((By.NAME, 'username')).send_keys(username)

    def input_password(self, password):
        self.find_element((By.NAME, 'password')).send_keys(password)

    def remember(self):
        self.click((By.ID, 'remember'))

    def btn_login(self):
        self.click((By.CLASS_NAME, 'loginbtn'))


if __name__ == '__main__':
    login = LoginPage('chrome')
    login.get('https://ecshop.test2.shopex123.com/user.php')

    # 执行测试用例
    login.input_username('luole')   #输入用户名
    login.input_password('1234567') #输入密码
    login.remember()    #勾选按钮
    login.btn_login()   #点击登录
    login.refresh()   #浏览器刷新
    login.back()   #浏览器后退
    login.forward()     #浏览器前进
    login.quit()       #退出页面